<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Video extends Model
{
    use HasFactory, HasDateTimeFormatter;

    public function types()
    {
        return $this->belongsToMany(Type::class, 'type_videos', 'video_id', 'type_id');
    }

    public function getCoverAttribute($value): string
    {
        return getFullUrlDomain($value);
    }
}
